package com.ruoyi.weiriya.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.weiriya.domain.WMemberChargeRecord;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户充电记录Mapper接口
 * 
 * @author lynn
 * @date 2023-08-01
 */
public interface WMemberChargeRecordMapper extends BaseMapper<WMemberChargeRecord>
{

    @Select("SELECT mcr.*, m.nick_name as member_name, a.name as area_name,vct.type_value as vehicle_type_name " +
            "FROM w_member_charge_record mcr " +
            "LEFT JOIN w_member m on m.id = mcr.member_id " +
            "LEFT JOIN w_vehicle_charge_type vct on vct.id = mcr.vehicle_type " +
            "LEFT JOIN w_area a on a.id = mcr.area_id ${ew.customSqlSegment}")
    List<WMemberChargeRecord> getList(@Param(Constants.WRAPPER) QueryWrapper<WMemberChargeRecord> queryWrapper);

    @Select("SELECT mcr.*, m.nick_name as member_name, a.name as area_name,vct.type_value as vehicle_type_name " +
            "FROM w_member_charge_record mcr " +
            "LEFT JOIN w_member m on m.id = mcr.member_id " +
            "LEFT JOIN w_vehicle_charge_type vct on vct.id = mcr.vehicle_type " +
            "LEFT JOIN w_area a on a.id = mcr.area_id " +
            "WHERE mcr.id = #{id}")
    WMemberChargeRecord getWMemberChargeRecordById(String id);
}
